Use the double version directly.
GtkDragSourceInfo *info;
GtkWidget *toplevel;
GdkDrag *drag;
+ double px, py;
int dx, dy;
GtkDragContent *content;
device = gdk_device_get_associated_device (device);
toplevel = gtk_widget_get_toplevel (widget);
- gtk_widget_translate_coordinates (widget, toplevel,
- x, y, &x, &y);
+ gtk_widget_translate_coordinates (widget, toplevel, x, y, &x, &y);
gdk_surface_get_device_position (gtk_widget_get_surface (toplevel),
- device,
- &dx, &dy,
- NULL);
- dx -= x;
- dy -= y;
+ device,
+ &px, &py,
+ NULL);
+ dx = round (px) - x;
+ dy = round (py) - y;
content = g_object_new (GTK_TYPE_DRAG_CONTENT, NULL);
content->widget = g_object_ref (widget);
device = gdk_device_get_associated_device (device);
if (device)
- gdk_surface_get_device_position (rect_surface, device, &rect.x, &rect.y, NULL);
+ {
+ double px, py;
+ gdk_surface_get_device_position_double (rect_surface, device, &px, &py, NULL);
+ rect.x = round (px);
+ rect.y = round (py);
+ }
}
}
else
const int max_x_distance = 32;
/* Max 48x48 icon + default padding */
const int max_anchor_rect_height = 48 + 8;
+ double px, py;
int pointer_x, pointer_y;
/*
* far away from the pointer position.
*/
effective_toplevel = _gtk_widget_get_surface (toplevel);
- gdk_surface_get_device_position (effective_toplevel,
- device,
- &pointer_x, &pointer_y, NULL);
+ gdk_surface_get_device_position_double (effective_toplevel,
+ device,
+ &px, &py, NULL);
+ pointer_x = round (px);
+ pointer_y = round (py);
if (anchor_rect.height > max_anchor_rect_height)
{
static void
gtk_tooltip_show_tooltip (GdkDisplay *display)
{
+ double px, py;
gint x, y;
GdkSurface *surface;
GtkWidget *tooltip_widget;
device = gdk_seat_get_pointer (gdk_display_get_default_seat (display));
- gdk_surface_get_device_position (surface, device, &x, &y, NULL);
+ gdk_surface_get_device_position_double (surface, device, &px, &py, NULL);
+ x = round (px);
+ y = round (py);
gdk_surface_get_root_coords (surface, x, y, &tx, &ty);
tooltip_widget = _gtk_widget_find_at_coords (surface, x, y, &x, &y);
g_object_set_data (G_OBJECT (tree_view), I_("gtk-tree-view-drag-info"), NULL);
}
-#if 0
-static gint
-drag_scan_timeout (gpointer data)
-{
- GtkTreeView *tree_view;
- gint x, y;
- GdkModifierType state;
- GtkTreePath *path = NULL;
- GtkTreeViewColumn *column = NULL;
- GdkRectangle visible_rect;
- GdkSeat *seat;
-
- tree_view = GTK_TREE_VIEW (data);
-
- seat = gdk_display_get_default_seat (gtk_widget_get_display (GTK_WIDGET (tree_view)));
- gdk_surface_get_device_position (tree_view->priv->bin_window,
- gdk_seat_get_pointer (seat),
- &x, &y, &state);
-
- gtk_tree_view_get_visible_rect (tree_view, &visible_rect);
-
- /* See if we are near the edge. */
- if ((x - visible_rect.x) < SCROLL_EDGE_SIZE ||
- (visible_rect.x + visible_rect.width - x) < SCROLL_EDGE_SIZE ||
- (y - visible_rect.y) < SCROLL_EDGE_SIZE ||
- (visible_rect.y + visible_rect.height - y) < SCROLL_EDGE_SIZE)
- {
- gtk_tree_view_get_path_at_pos (tree_view,
- tree_view->priv->bin_window,
- x, y,
- &path,
- &column,
- NULL,
- NULL);
-
- if (path != NULL)
- {
- gtk_tree_view_scroll_to_cell (tree_view,
- path,
- column,
- TRUE,
- 0.5, 0.5);
-
- gtk_tree_path_free (path);
- }
- }
-
- return TRUE;
-}
-#endif /* 0 */
-
static void
add_scroll_timeout (GtkTreeView *tree_view)
{